Learn R Programming

phyloseq (version 1.16.2)

taxa_names<-: Replace OTU identifier names

Description

Replace OTU identifier names

Usage

taxa_names(x) <- value

## S3 method for class 'ANY,ANY': taxa_names(x) <- value

## S3 method for class 'ANY,character': taxa_names(x) <- value

## S3 method for class 'otu_table,character': taxa_names(x) <- value

## S3 method for class 'taxonomyTable,character': taxa_names(x) <- value

## S3 method for class 'phylo,character': taxa_names(x) <- value

## S3 method for class 'XStringSet,character': taxa_names(x) <- value

## S3 method for class 'phyloseq,character': taxa_names(x) <- value

Arguments

x
(Required). An object defined by the phyloseq-package that describes OTUs in some way.
value
(Required). A character vector to replace the current taxa_names.

Examples

Run this code
data("esophagus")
taxa_names(esophagus)
# plot_tree(esophagus, label.tips="taxa_names", ladderize="left")
taxa_names(esophagus) <- paste("OTU-", taxa_names(esophagus), sep="")
taxa_names(esophagus)
# plot_tree(esophagus, label.tips="taxa_names", ladderize="left")
## non-characters are first coerced to characters.
taxa_names(esophagus) <- 1:ntaxa(esophagus)
taxa_names(esophagus)
# plot_tree(esophagus, label.tips="taxa_names", ladderize="left")
## Cannot assign non-unique or differently-lengthed name vectors. Error.
# taxa_names(esophagus) <- sample(c(TRUE, FALSE), ntaxa(esophagus), TRUE)
# taxa_names(esophagus) <- sample(taxa_names(esophagus), ntaxa(esophagus)-5, FALSE)

Run the code above in your browser using DataLab